package com.flight.trans.adapter;

import android.content.Context;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.flight.trans.R;
import com.flight.trans.base.BaseRecyclerAdapter;
import com.flight.trans.base.BaseViewHolder;
import com.flight.trans.bean.LeavePortCollectCheckBean.LeavePortCollectCheckData;
import com.flight.trans.util.CommonUtils;

import java.util.List;

/**
 * 出港收运
 */
public class LeavePortCollectCheckAdapter extends BaseRecyclerAdapter<LeavePortCollectCheckData> {

    public LeavePortCollectCheckAdapter(Context mContext, List<LeavePortCollectCheckData> mList) {
        super(mContext, mList);
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_leave_port_collect_check;
    }

    @Override
    protected void bindData(BaseViewHolder holder, LeavePortCollectCheckData data, int position) {
        LinearLayout mLlContainerItem = holder.findViewById(R.id.mLlContainerItem);

        TextView mTvOrderNo = holder.findViewById(R.id.mTvOrderNo);
        TextView mTvOrderCount = holder.findViewById(R.id.mTvOrderCount);
        TextView mTvProductName = holder.findViewById(R.id.mTvProductName);
        TextView mTvDeep = holder.findViewById(R.id.mTvDeep);
        TextView mTvFlightNo = holder.findViewById(R.id.mTvFlightNo);
        TextView mTvSender = holder.findViewById(R.id.mTvSender);
        TextView mTvRemarks = holder.findViewById(R.id.mTvRemarks);

        CommonUtils.setScreenViewVisible(mTvDeep);
        CommonUtils.setScreenViewVisible(mTvFlightNo);
        CommonUtils.setScreenViewVisible(mTvSender);

        mTvOrderNo.setText(data.getOrderNo());
        mTvOrderCount.setText(String.valueOf(data.getNum()));
        mTvProductName.setText(data.getTradeName());
        mTvDeep.setText(data.getDeap());
        mTvFlightNo.setText(data.getFlightNo());
        mTvSender.setText(data.getSenderName());
        mTvRemarks.setText(data.getRemark());

        mLlContainerItem.setBackground(mContext.getDrawable(data.isLocked() ? R.color.color_red : R.drawable.selector_cyan_line));

        setOnItemClickListener(mLlContainerItem , position);
    }
}
